#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Stu Stu;
struct Stu {
	char name[20];
	int age;
};
void Print(Stu s[],size_t sz)
{
	for (int i = 0; i < sz; i++)
	{
		printf("%s ", s[i].name);
		printf("%d\n", s[i].age);
	}
}
int sort_name(const void* p1, const void* p2)
{
	return strcmp((*(Stu*)p1).name, (*(Stu*)p2).name);
}
int main()
{
	Stu s[] = {{"wangwu",20},{"zhaojie",19},{"lisi",32}};
	size_t sz= sizeof(s) / sizeof(s[0]);
	/*Print(s,sz);*/
	qsort(s, sz, sizeof(s[0]), sort_name);
	Print(s, sz);
	return 0;
}